<?php
$c = Eleanor::$Cache->Get('right_'. Language::$main);
if ($c === false) {
	global $Eleanor;
	$lang = Eleanor::$Language->load(Eleanor::$rootf .'modules/adver/lang_user-*.php');
	$def_image = '/templates/AutoDiagnostika/images/new_reviews.png';
	$R = Eleanor::$Db->Query('SELECT `id`, `cats`, `title`, `text`, `ldate`, `uri`, (SELECT `path` FROM `'. P .'adver_images` WHERE `adver_id` = `a`.`id` ORDER BY `id` LIMIT 1) AS `image` FROM `'. P .'adver` AS `a` INNER JOIN `'. P .'adver_l` USING(`id`) WHERE `language`IN("", "'. Language::$main. '") AND `lstatus` = 1 ORDER BY `ldate` DESC LIMIT 4');
	while ($a = $R->fetch_assoc()) {
		$c .= '<article class="document_body_right_menu_record">
		<img class="document_body_right_menu_image" src="'.( $a['image'] ? $a['image'] : $def_image ).'" alt="'. htmlspecialchars($a['title'], ENT_QUOTES) .'" height="54">
		<div class="document_body_right_menu_company">'. $a['title'] .'</div>
		<div class="document_body_right_menu_date">'. $a['ldate'] .'</div>
		<div class="document_body_right_menu_text">'. Strings::CutStr(strip_tags($a['text']), 30) .'</div>
		<div class="document_body_right_menu_more"><a href="'. $Eleanor->Url->Construct(array('module' => 'advertisement') + $Eleanor->Categories->GetUri((int)ltrim($a['cats'],',')) + array('u' => array($a['uri'], 'nid' => $a['id'])), false, true, true) .'">'. $lang['readmore'] .'</a></div>
		<div class="document_body_right_menu_border"></div>
		</article>';
	}
	$c = $c . '<div id="document_body_right_menu_read_all_border"><div id="document_body_right_menu_read_all"><a href="'. $Eleanor->Url->Construct(array('module' => 'advertisement'), false) .'">'. $lang['readmore'] .'</a></div></div>';
    Eleanor::$Cache->Put('right_'. Language::$main, $c);
}
return $c;